package packageclass;

public class Demo {
	public static void main(String[] args) {
		//基本数据类型：byte 1,short 2,int 4,long 8,float 4,double 8,boolean 1,char2
		//包装类(封装): Byte,Short,Integer,Long,Float,Double,Boolean,Character
		byte b = 1;  // 1，没有属性，没有方法
	
		Byte b2 = new Byte((byte) 1);  //引用类型
		//1.基本类型和包装类之间转换
		Byte b3 = b;   // 底层 new Byte(b); 自动装箱: 基本类型给引用类型赋值
		byte b4 = b3;  // 自动拆箱：引用类型给基本类型赋值
		
		Integer i = 10;  // new Integer(10);
		int j = i;    //   i.intValue();
		
		Character ch = '哈';
		char ch2 = ch;
		System.out.println(ch2);
		
		// 静态的常量
		System.out.println(Byte.MAX_VALUE);
		System.out.println(Byte.MIN_VALUE);
		System.out.println(Integer.MAX_VALUE);
		System.out.println(Integer.MIN_VALUE);
		System.out.println(Short.MAX_VALUE);
		System.out.println(Short.MIN_VALUE);
		System.out.println(Long.MAX_VALUE);
		System.out.println(Long.MIN_VALUE);
		System.out.println(Float.MAX_VALUE);
		System.out.println(Float.MIN_VALUE);
		System.out.println(Double.MAX_VALUE);
		System.out.println(Double.MIN_VALUE);
		
		//一般封装类不new对象  valueOf(基本类型/String)
		Byte by1 = Byte.valueOf((byte) 1);
		Byte by2 = Byte.valueOf("123");
		Short s = Short.valueOf((short) 123);
		Short s2 = Short.valueOf("123");
		Integer i1 = Integer.valueOf(123);
		Integer i2 = Integer.valueOf("123");
		Long l1 = Long.valueOf(123);
		Long l2 = Long.valueOf("123");
		Float f1 = Float.valueOf(1.1F);
		Float f2 = Float.valueOf("1.1F");
		Double d1 = Double.valueOf(2.2);
		Double d2 = Double.valueOf("2.2");
		Boolean b1 = Boolean.valueOf(true);
		Boolean bl2 = Boolean.valueOf("false");
		// 只有char封装类没有valueOf(String)方法，其他都可以把字符串转成自己封装类型的方法
		Character c1 = Character.valueOf('a');
		
		//封装类都有parseXXX("str"); char没有   parse解析
		byte parseByte = Byte.parseByte("123");
		short parseShort = Short.parseShort("123");
		int parseInt = Integer.parseInt("123");
		long parseLong = Long.parseLong("123");
		double parseDouble = Double.parseDouble("1.2");
		
		System.out.println("判断是否是字符:" + Character.isLetter('a'));
		System.out.println("判断是否是数字:" + Character.isDigit('1'));
		System.out.println("转成大写:" + Character.toUpperCase('a'));
		System.out.println("转成小写:" + Character.toLowerCase('W'));
		
		String str = "als29rlasaQ@RFAsp9jsalaoi2";  //  str.length();  str.charAt(i)
		int numCount = 0;
		int smallCount = 0;
		int bigCount = 0;
		int other = 0;
		//1.循环遍历str字符串
		for (int k = 0,strlength = str.length() ; k < strlength; k++) {
			char c = str.charAt(k);  // 获取k下标位置的字符
			// 判断是否数字
			if (Character.isDigit(c)) {
				numCount++;
			}else if(Character.isUpperCase(c)) { //是否是大写
				bigCount++;
			}else if(Character.isLowerCase(c)) { //是否是小写
				smallCount++;
			}else {
				other++;
			}
		}
		System.out.println(numCount);
		System.out.println(smallCount);
		System.out.println(bigCount);
		System.out.println(other);
	}
}
